package exercise;

import java.time.LocalDateTime;
import java.time.Month;
import java.time.temporal.ChronoField;

/**
 * @classname:LocalDateTime
 * @description:
 * @author: Mr.Z
 * @date: 2020/12/10 11:35
 * @version: 0.1
 * @since:1.8
 */
public class LocalDateTimeDemo {
    public static void main(String[] args) {
        LocalDateTime now = LocalDateTime.now();
        System.out.println(now);
        LocalDateTime of = LocalDateTime.of(2020, 12, 23, 12, 00, 12);
        LocalDateTime of1 = LocalDateTime.of(2020, Month.APRIL, 23, 12, 23, 12);

        LocalDateTime localDateTime = now.plusDays(10);
        System.out.println(localDateTime);
        LocalDateTime localDateTime1 = localDateTime.minusYears(2);
        System.out.println(localDateTime1);
        int i = now.get(ChronoField.YEAR);
        System.out.println(i);
        int monthValue = now.getMonthValue();
        System.out.println(monthValue);
        Month month = now.getMonth();
        System.out.println(month);

    }
}
